<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="https://www.kuaidi100.com/css/www/common.css">
    <link rel="stylesheet" href="https://www.kuaidi100.com/css/www/home.css">
    <style>@media print {
        body {
            -webkit-print-color-adjust: exact;
            -moz-print-color-adjust: exact;
            -ms-print-color-adjust: exact;
            print-color-adjust: exact;
        }

        button {
            display: none;
        }
    }

    body {
        height: auto;
        min-width: auto;
    }

    .result-body .sort {
        border: none;
    }

    .result-body .sort::after {
        display: none;
    }

    .result-body .datetime, .result-body .step-icon, .result-body .step .text, .result-body .title .text {
        *display: inline;
        zoom: 1;
    }</style>
</head>
<body>
<div class="result-body">
    <div class="result" style="height: 700px">
        <ul class="content" id="content">

        </ul>
        <div style="clear:both;"></div>
    </div>
</div>
</body>
<script src="/jquery-3.5.1.min.js"></script>
<script src="/url.js"></script>
<script type="text/javascript">
    var url = requestUrl + "/erupt-api/logistics/get";
    var ids = new URLSearchParams(location.href.split('?')[1]).get("ids")
    $.ajax({
        type: "POST",
        url: url,
        headers: {
            token: parent.getAppToken().token
        },
        data: {orderId: ids},
        datatype: "json",
        success: function (result) {
            console.log(result)
            if (result.code == 1) {
                appendDate(result.data);
            } else {
                alert(result.msg)
            }
        }
    });

    function appendDate(data) {
        let infoLog = JSON.parse(data.infoLog);
        if(infoLog == undefined || infoLog.data == undefined){
            alert("未查询到物流信息")
            return;
        }
        for (let index = 0; index < infoLog.data.length; index++) {
            let item = infoLog.data[index]
            let li = document.createElement('li');
            if (index == 0) {
                li.innerHTML = '<li class="step start">\n' +
                    '                <div class="datetime">' + item.ftime + '</div>\n' +
                    '                <div class="step-icon"></div>\n' +
                    '                <div class="text">' + item.context + '</div>\n' +
                    '            </li>'
            } else if (index == infoLog.data.length - 1) {
                li.innerHTML = '<li class="step end">\n' +
                    '                <div class="datetime">' + item.ftime + '</div>\n' +
                    '                <div class="step-icon"></div>\n' +
                    '                <div class="text">' + item.context + '</div>\n' +
                    '            </li>'
            } else {
                li.innerHTML = '<li class="step">\n' +
                    '                <div class="datetime">' + item.ftime + '</div>\n' +
                    '                <div class="step-icon"></div>\n' +
                    '                <div class="text">' + item.context + '</div>\n' +
                    '            </li>'
            }
            document.getElementById('content').appendChild(li)
        }
    }

</script>

</html>